package al.xc.service.impl;

import al.xc.data.dto.userinfo.getUserInfoRef;
import al.xc.datasource.mapper.UserInfoMapper;
import al.xc.datasource.model.UserInfo;
import al.xc.service.IUserService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserServiceImpl implements IUserService {

    private UserInfoMapper Mapper;

    public List<getUserInfoRef> find(String token){
List<UserInfo> items= Mapper.selectList(new LambdaQueryWrapper<UserInfo>());
List<getUserInfoRef> RefItems=new ArrayList<getUserInfoRef>();
        for (UserInfo item : items){
            getUserInfoRef ref= new   getUserInfoRef();
            ref.setId(item.getId());
            ref.setUserID(item.getUserID());
            ref.setParentUserID(item.getParentUserID());
            ref.setPreferentialAmount(item.getPreferentialAmount());
            ref.setViolationTime(item.getViolationTime());
            ref.setViolationNeedPay(item.getViolationNeedPay());
            ref.setRemarks(item.getRemarks());
            ref.setIsDel(item.getIsDel());
            ref.setAddTime(item.getAddTime());
            ref.setAddUserID(item.getAddUserID());
            ref.setUpTime(item.getUpTime());
            ref.setUpUserID(item.getUpUserID());
            ref.setTotalConsumption(item.getTotalConsumption());
            ref.setReturnsNumber(item.getReturnsNumber());
            ref.setWithdrawalAmount(item.getWithdrawalAmount());
            ref.setUnWithdrawalAmount(item.getUnWithdrawalAmount());
            RefItems.add(ref);
     }
        return RefItems;
    }
}
